From: Giovanni Campagna Date: Thu, 21 Feb 2013 22:32:25 +0000 (+0100) Subject: ScreenShield: fix positioning of background with multimonitor X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4642 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d5e647a191b23c8a153223976e720b64c336d638;p=gnome-shell.git ScreenShield: fix positioning of background with multimonitor Previously, we would create one StBin per monitor, but each was positioned at 0,0 and sized as the screen, so they would overlap and draw the box shadows on top of the other backgrounds. Instead, we need to size appropriately the bin, and then we need to position the actual MetaBacgroundActor at 0,0, so add a flag to BackgroundManager for this. Also, get rid of MetaBackgroundGroup, they do nothing because the screenshield is not a descendant of the MetaWindowGroup and because the widget in between blocks the propagation of the visible region. At the same time, use a widget, not a bin, because StBin requires you to set .child, not call add_child(). https://bugzilla.gnome.org/show_bug.cgi?id=694394 --- diff --git a/js/ui/background.js b/js/ui/background.js index ef4dad3e3..326805905 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -635,12 +635,14 @@ const BackgroundManager = new Lang.Class({ params = Params.parse(params, { container: null, layoutManager: Main.layoutManager, monitorIndex: null, - effects: Meta.BackgroundEffects.NONE }); + effects: Meta.BackgroundEffects.NONE, + controlPosition: true }); this._container = params.container; this._layoutManager = params.layoutManager; this._effects = params.effects; this._monitorIndex = params.monitorIndex; + this._controlPosition = params.controlPosition; this.background = this._createBackground(); this._newBackground = null; @@ -700,9 +702,12 @@ const BackgroundManager = new Lang.Class({ this._container.add_child(background.actor); let monitor = this._layoutManager.monitors[this._monitorIndex]; - background.actor.set_position(monitor.x, monitor.y); + background.actor.set_size(monitor.width, monitor.height); - background.actor.lower_bottom(); + if (this._controlPosition) { + background.actor.set_position(monitor.x, monitor.y); + background.actor.lower_bottom(); + } let signalId = background.connect('changed', Lang.bind(this, function() { background.disconnect(signalId); diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 5ab593f4f..7b3953b7c 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -447,7 +447,7 @@ const ScreenShield = new Lang.Class({ this._lockScreenGroup.add_actor(this._lockScreenContents); - this._backgroundGroup = new Meta.BackgroundGroup(); + this._backgroundGroup = new Clutter.Actor(); this._lockScreenGroup.add_actor(this._backgroundGroup); this._backgroundGroup.lower_bottom(); @@ -538,21 +538,22 @@ const ScreenShield = new Lang.Class({ }, _createBackground: function(monitorIndex) { - let bin = new St.Bin({ style_class: 'screen-shield-background' }); - - let group = new Meta.BackgroundGroup(); - bin.child = group; - - let bgManager = new Background.BackgroundManager({ container: group, + let monitor = Main.layoutManager.monitors[monitorIndex]; + let widget = new St.Widget({ style_class: 'screen-shield-background', + x: monitor.x, + y: monitor.y, + width: monitor.width, + height: monitor.height }); + + let bgManager = new Background.BackgroundManager({ container: widget, monitorIndex: monitorIndex, - effects: Meta.BackgroundEffects.BLUR | Meta.BackgroundEffects.DESATURATE }); - + effects: Meta.BackgroundEffects.BLUR | Meta.BackgroundEffects.DESATURATE, + controlPosition: false }); bgManager.background.saturation = 0.6; this._bgManagers.push(bgManager); - this._backgroundGroup.add_child(bin); - bin.lower_bottom(); + this._backgroundGroup.add_child(widget); }, _updateBackgrounds: function() {